import 'package:enterprise_v6_app/generated/json/base/json_convert_content.dart';
import 'package:enterprise_v6_app/app/data/entities/application/basic_information/compliance_file_entity.dart';

ComplianceFileEntity $ComplianceFileEntityFromJson(Map<String, dynamic> json) {
  final ComplianceFileEntity complianceFileEntity = ComplianceFileEntity();
  final String? companyCode = jsonConvert.convert<String>(json['companyCode']);
  if (companyCode != null) {
    complianceFileEntity.companyCode = companyCode;
  }
  final String? createBy = jsonConvert.convert<String>(json['createBy']);
  if (createBy != null) {
    complianceFileEntity.createBy = createBy;
  }
  final String? createById = jsonConvert.convert<String>(json['createById']);
  if (createById != null) {
    complianceFileEntity.createById = createById;
  }
  final String? createDate = jsonConvert.convert<String>(json['createDate']);
  if (createDate != null) {
    complianceFileEntity.createDate = createDate;
  }
  final String? deleted = jsonConvert.convert<String>(json['deleted']);
  if (deleted != null) {
    complianceFileEntity.deleted = deleted;
  }
  final String? effectiveDate = jsonConvert.convert<String>(json['effectiveDate']);
  if (effectiveDate != null) {
    complianceFileEntity.effectiveDate = effectiveDate;
  }
  final int? fileChildType = jsonConvert.convert<int>(json['fileChildType']);
  if (fileChildType != null) {
    complianceFileEntity.fileChildType = fileChildType;
  }
  final String? fileConfigId = jsonConvert.convert<String>(json['fileConfigId']);
  if (fileConfigId != null) {
    complianceFileEntity.fileConfigId = fileConfigId;
  }
  final String? fileHistory = jsonConvert.convert<String>(json['fileHistory']);
  if (fileHistory != null) {
    complianceFileEntity.fileHistory = fileHistory;
  }
  final String? fileName = jsonConvert.convert<String>(json['fileName']);
  if (fileName != null) {
    complianceFileEntity.fileName = fileName;
  }
  final String? fileObject = jsonConvert.convert<String>(json['fileObject']);
  if (fileObject != null) {
    complianceFileEntity.fileObject = fileObject;
  }
  final String? fileUrl = jsonConvert.convert<String>(json['fileUrl']);
  if (fileUrl != null) {
    complianceFileEntity.fileUrl = fileUrl;
  }
  final String? formId = jsonConvert.convert<String>(json['formId']);
  if (formId != null) {
    complianceFileEntity.formId = formId;
  }
  final String? id = jsonConvert.convert<String>(json['id']);
  if (id != null) {
    complianceFileEntity.id = id;
  }
  final String? organizationDate = jsonConvert.convert<String>(json['organizationDate']);
  if (organizationDate != null) {
    complianceFileEntity.organizationDate = organizationDate;
  }
  final String? remark = jsonConvert.convert<String>(json['remark']);
  if (remark != null) {
    complianceFileEntity.remark = remark;
  }
  final String? statusName = jsonConvert.convert<String>(json['statusName']);
  if (statusName != null) {
    complianceFileEntity.statusName = statusName;
  }
  final String? updateBy = jsonConvert.convert<String>(json['updateBy']);
  if (updateBy != null) {
    complianceFileEntity.updateBy = updateBy;
  }
  final String? updateById = jsonConvert.convert<String>(json['updateById']);
  if (updateById != null) {
    complianceFileEntity.updateById = updateById;
  }
  final String? updateDate = jsonConvert.convert<String>(json['updateDate']);
  if (updateDate != null) {
    complianceFileEntity.updateDate = updateDate;
  }
  final List<ComplianceFileEntity>? fileHistoryArray = (json['fileHistoryArray'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<ComplianceFileEntity>(e) as ComplianceFileEntity).toList();
  if (fileHistoryArray != null) {
    complianceFileEntity.fileHistoryArray = fileHistoryArray;
  }
  return complianceFileEntity;
}

Map<String, dynamic> $ComplianceFileEntityToJson(ComplianceFileEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['companyCode'] = entity.companyCode;
  data['createBy'] = entity.createBy;
  data['createById'] = entity.createById;
  data['createDate'] = entity.createDate;
  data['deleted'] = entity.deleted;
  data['effectiveDate'] = entity.effectiveDate;
  data['fileChildType'] = entity.fileChildType;
  data['fileConfigId'] = entity.fileConfigId;
  data['fileHistory'] = entity.fileHistory;
  data['fileName'] = entity.fileName;
  data['fileObject'] = entity.fileObject;
  data['fileUrl'] = entity.fileUrl;
  data['formId'] = entity.formId;
  data['id'] = entity.id;
  data['organizationDate'] = entity.organizationDate;
  data['remark'] = entity.remark;
  data['statusName'] = entity.statusName;
  data['updateBy'] = entity.updateBy;
  data['updateById'] = entity.updateById;
  data['updateDate'] = entity.updateDate;
  data['fileHistoryArray'] = entity.fileHistoryArray?.map((v) => v.toJson()).toList();
  return data;
}

extension ComplianceFileEntityExtension on ComplianceFileEntity {
  ComplianceFileEntity copyWith({
    String? companyCode,
    String? createBy,
    String? createById,
    String? createDate,
    String? deleted,
    String? effectiveDate,
    int? fileChildType,
    String? fileConfigId,
    String? fileHistory,
    String? fileName,
    String? fileObject,
    String? fileUrl,
    String? formId,
    String? id,
    String? organizationDate,
    String? remark,
    String? statusName,
    String? updateBy,
    String? updateById,
    String? updateDate,
    List<ComplianceFileEntity>? fileHistoryArray,
  }) {
    return ComplianceFileEntity()
      ..companyCode = companyCode ?? this.companyCode
      ..createBy = createBy ?? this.createBy
      ..createById = createById ?? this.createById
      ..createDate = createDate ?? this.createDate
      ..deleted = deleted ?? this.deleted
      ..effectiveDate = effectiveDate ?? this.effectiveDate
      ..fileChildType = fileChildType ?? this.fileChildType
      ..fileConfigId = fileConfigId ?? this.fileConfigId
      ..fileHistory = fileHistory ?? this.fileHistory
      ..fileName = fileName ?? this.fileName
      ..fileObject = fileObject ?? this.fileObject
      ..fileUrl = fileUrl ?? this.fileUrl
      ..formId = formId ?? this.formId
      ..id = id ?? this.id
      ..organizationDate = organizationDate ?? this.organizationDate
      ..remark = remark ?? this.remark
      ..statusName = statusName ?? this.statusName
      ..updateBy = updateBy ?? this.updateBy
      ..updateById = updateById ?? this.updateById
      ..updateDate = updateDate ?? this.updateDate
      ..fileHistoryArray = fileHistoryArray ?? this.fileHistoryArray;
  }
}
